
#include "core.h"
#include "msg_handler.h"


void *coll_run(void *param)
{
    cfg_pu_t* pu = (cfg_pu_t*)param;
    dlmodule_t *dlmodule = (dlmodule_t *)pu->hanlder.dlmodule;
    if (NULL == dlmodule)
    {
        LOG_E("core", "collect_run portname %s dlmodule is NULL", pu->name);
        pu = pu->next;
        pthread_exit(NULL);
    }

    while(1)
    {
        if(dlmodule->run(pu) < 0)
        {
            break;
        }
        usleep(1000000);
    }

    pthread_exit(NULL);
}

void *trans_run(void* param)
{
    cfg_pu_t* pu = (cfg_pu_t*)param;
    dlmodule_t* dlmodule = (dlmodule_t*)pu->hanlder.dlmodule;
    if (NULL == dlmodule)
    {
        LOG_E("core", "trans_run portname %s dlmodule is NULL", pu->name);
        pu = pu->next;
        pthread_exit(NULL);
    }

    while (1)
    {
        if (dlmodule->run(pu) < 0)
        {
            break;
        }
        usleep(1000000);
    }

    pthread_exit(NULL);
}